{% extends 'djangobb_forum/base.html' %}
{% load forum_extras %}
{% load i18n %}

{% block content %}
<div class="linkst">
	<div class="inbox">
		{% if forum %}
		<ul class="start"><li><a href="{% url djangobb:index %}">{% trans "Root" %}</a> </li><li>&raquo; {% link forum %}</li></ul>
		{% else %}
			<ul><li><a href="{% url djangobb:index %}">{% trans "Root" %}</a> </li><li>&raquo; {% link topic.forum %}</li><li>&raquo; {{ topic }}</li></ul>
		{% endif %}
		<div class="clearer"></div>
	</div>
</div>

<div class="blockform">
	<h2><span>{% if forum %}{% trans "New topic" %}{% else %}{% trans "New reply" %}{% endif %}</span></h2>
	<div class="box">
		<form id="post" action="{% if forum %}{% url djangobb:add_topic forum.id %}{% else %}{% url djangobb:add_post topic.id %}{% endif %}" method="post" enctype="multipart/form-data">
			{% csrf_token %}
			<div class="inform">
				<fieldset>
					<legend>{% trans "Write your message and submit" %}</legend>
					<div class="infldset txtarea">
						{% if forum %}
							<label><strong>{% trans "Subject" %}</strong><br />{{ form.name.errors }}{{ form.name }}<br /></label>
						{% endif %}
						<label><strong>{% trans "Message" %}</strong><br />{{ form.body.errors }}{{ form.body }}<br /></label>
					</div>
				</fieldset>
			</div>
			{% if forum_settings.ATTACHMENT_SUPPORT %}
			<div class="inform">
				<fieldset>
					<legend>{% trans "Attachment" %}</legend>
					<div class="infldset">
						{{ form.attachment.errors }}
						<div class="rbox">
							{{ form.attachment }}
						</div>
					</div>
				</fieldset>
			</div>
			{% endif %}

			<p><input type="submit" value="{% trans "Submit" %}" /><a href="javascript:history.go(-1)">{% trans "Go back" %}</a></p>
		</form>
	</div>
</div>

{% if not forum %}
<div id="postreview" class="blockpost">

	<h2><span>{% trans "Topic review (newest first)" %}</span></h2>
	{% for post in posts reversed %}
	<div class="box rowodd">
		<div class="inbox">
			<div class="postleft">
				<dl>
					<dt><strong><a href="javascript:pasteN('{{ post.user.username }}');">{{ post.user.username }}</a></strong></dt>
					<dd>{% forum_time post.created %}</dd>
				</dl>
			</div>
			<div class="postright">
				<div class="postmsg">
					{{ post.body_html|safe }}
				</div>
			</div>
			<div class="clearer"></div>
						<div class="postfootright"><ul><li class="postquote"><a onmouseover="copyQ('{{ post.user.username }}');" href="javascript:pasteQ();">{% trans "Quote" %}</a></li></ul></div>
		</div>
	</div>
	{% endfor %}
	
</div>
{% endif %}

{% endblock %}
